var t = function(t) {
    return t && t.__esModule ? t : {
      default: t
    };
}(require("../../../../utils/toot.js")),
  a = getApp();

Page({
  data: {
    myDcoBoo: !0,
    modelBoo: !1,
    backBoo: !1,
    authState: null,
    id: 3,
    url: "team/sign/info/",
    signType: 3,
    doctor: {
      teamHeaderUrl: '/assets/images/795.png',
      teamName: '小花的工作室',
      patientCount: 10,
      askNum: 20,
      teamDesc: '专业接骨20年',
      teamType: 1,
      doctorCount: 100,
      creater: {
        doctorName: '小花'
      },
      bgGoodAt: ['骨科', '牙科', '大脑'],
      briefIntroduce: '专业治病20年'
    },
    service: [{
        cdInterroga: '290101',
        currentPrice: 10000,
        servicePrice: 20000
      },
      {
        cdInterroga: '290102',
        currentPrice: 10000,
        servicePrice: 20000
      },
      {
        cdInterroga: '290103',
        currentPrice: 10000,
        servicePrice: 20000
      },
      {
        cdInterroga: '290104',
        currentPrice: 10000,
        servicePrice: 20000
      }
    ],
    service: [{
        cdInterroga: 290101,
        currentPrice: 1000,
        servicePrice: 2000
      },
      {
        cdInterroga: 290102,
        currentPrice: 1000,
        servicePrice: 2000
      },
      {
        cdInterroga: 290103,
        currentPrice: 1000,
        servicePrice: 2000
      },
      {
        cdInterroga: 290104,
        currentPrice: 1000,
        servicePrice: 2000
      },
    ],
    options: 0,
    works: [{
        title: '说说怎么预防感冒',
        tiem: '50',
        money: ''
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '50'
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '10'
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '80'
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '50'
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '10'
      },
      {
        title: '说说怎么预防感冒',
        tiem: '50',
        money: '80'
      }
    ],
    servicePackage: [{
        title: '手术快约',
        state: 0
      },
      {
        title: '手术快约',
        state: 1
      },
      {
        title: '手术快约',
        state: 0
      }
    ],
    specialService: [{
        effect: 80,
        satisfied: 60,
        about: 200,
        title: '换骨头方案'
      },
      {
        effect: 80,
        satisfied: 60,
        about: 200,
        title: '换骨头方案'
      },
      {
        effect: 80,
        satisfied: 60,
        about: 200,
        title: '换骨头方案'
      },
      {
        effect: 80,
        satisfied: 60,
        about: 200,
        title: '换骨头方案'
      },
      {
        effect: 80,
        satisfied: 60,
        about: 200,
        title: '换骨头方案'
      }
    ]
  },
  onLoad: function (e) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    // var o = this,
    //   n = this;
    // this.setData({
    //   token: wx.getStorageSync("logs"),
    //   doctorId: e.doctorId,
    //   jobType: e.jobType,
    //   myDoctor: wx.getStorageSync("myDoctor") || [],
    //   myNurse: wx.getStorageSync("myNurse") || [],
    //   myTeam: wx.getStorageSync("myTeam") || [],
    //   personalFlag: e.personalFlag || "",
    //   lookOverBoo: e.lookOverBoo || ""
    // }), wx.showLoading({
    //   title: "加载中...",
    //   mask: !0
    // }), this.data.token ? (t.default.doctorIntro(n), t.default.authState(n)) : wx.login({
    //   success: function(e) {
    //     var n = o,
    //       r = e.code;
    //     wx.request({
    //       url: a.globalData.httpLogin + "user/code",
    //       data: {
    //         code: r,
    //         token: n.data.token
    //       },
    //       success: function(a) {
    //         var e = a.data.data.token,
    //           o = a.data.data.bindPhone;
    //         n.setData({
    //           token: e
    //         });
    //         try {
    //           wx.setStorageSync("logs", e);
    //         } catch (t) {}
    //         try {
    //           wx.setStorageSync("bindPhone", o);
    //         } catch (t) {}
    //         t.default.doctorIntro(n), t.default.authState(n);
    //       },
    //       fail: function(t) {}
    //     });
    //   }
    // });
  },
  selectBtn: function() {
    var t = this;
    if (1 == t.data.personalFlag)
      if (t.data.personalArr.gender && t.data.personalArr.name && t.data.personalArr.phone) {
        if (0 != t.data.myDoctor.length) return console.log(111), void t.setData({
          yetFlag: !0,
          yetMsg: "当前您已与健康顾问签约，不能再签约团队顾问，需要与健康顾问解约后，才能与团队顾问签约。",
          targetDoctor: t.data.myDoctor
        });
        if (0 != t.data.myNurse.length) return console.log(2222), void t.setData({
          yetFlag: !0,
          yetMsg: "当前您已与护理顾问签约，不能再签约团队顾问，需要与护理顾问解约后，才能与团队顾问签约。",
          targetDoctor: t.data.myNurse
        });
        if (0 != t.data.myTeam.length) return console.log(3333), void t.setData({
          yetFlag: !0,
          yetMsg: "当前您已与其他团队顾问签约，不能再签约此团队顾问，需要与当前团队顾问解约后，才能与此团队顾问签约。",
          targetDoctor: t.data.myTeam
        });
        this.setData({
          modelBoo: !0
        });
      } else wx.showModal({
        title: "个人信息未完善",
        cancelText: "以后再说",
        confirmText: "去完善",
        confirmColor: "#3b4ca9",
        success: function(t) {
          t.confirm && wx.navigateTo({
            url: "/hyb_yl/userShopping/pages/index1/index1"
          });
        }
      });
    else {
      if (0 != t.data.myDoctor.length) return console.log(111), void t.setData({
        yetFlag: !0,
        yetMsg: "当前您已与健康顾问签约，不能再签约团队顾问，需要与健康顾问解约后，才能与团队顾问签约。",
        targetDoctor: t.data.myDoctor
      });
      if (0 != t.data.myNurse.length) return console.log(2222), void t.setData({
        yetFlag: !0,
        yetMsg: "当前您已与护理顾问签约，不能再签约团队顾问，需要与护理顾问解约后，才能与团队顾问签约。",
        targetDoctor: t.data.myNurse
      });
      if (0 != t.data.myTeam.length) return console.log(3333), void t.setData({
        yetFlag: !0,
        yetMsg: "当前您已与其他团队顾问签约，不能再签约此团队顾问，需要与当前团队顾问解约后，才能与此团队顾问签约。",
        targetDoctor: t.data.myTeam
      });
      this.setData({
        modelBoo: !0
      });
    }
  },
  abolishBtn: function() {
    this.setData({
      modelBoo: !1
    });
  },
  signedBtn: function() {
    var a = this;
    t.default.signedBtn(a);
  },
  cancelBtn: function(a) {
    var e = a.target.dataset.signid,
      o = this;
    this.setData({
      signId: e
    }), o.data.confirmFlag && (o.data.confirmFlag = !1), t.default.getDoctor(o);
  },
  checkboxChange: function(a) {
    var e = this;
    t.default.authorized(e, a);
  },
  onReady: function() {},
  onShow: function() {
    var e = this,
      o = this;
    1 == o.data.personalFlag && (this.data.token ? t.default.getBasicInfo(o) : wx.login({
      success: function(o) {
        var n = e,
          r = o.code;
        wx.request({
          url: a.globalData.httpLogin + "user/code",
          data: {
            code: r,
            token: n.data.token
          },
          success: function(a) {
            var e = a.data.data.token,
              o = a.data.data.bindPhone;
            n.setData({
              token: e
            });
            try {
              wx.setStorageSync("logs", e);
            } catch (t) {}
            try {
              wx.setStorageSync("bindPhone", o);
            } catch (t) {}
            t.default.getBasicInfo(n);
          },
          fail: function(t) {}
        });
      }
    }));
  },
  onHide: function() {},
  onUnload: function() {
    this.data.backBoo && wx.navigateBack({
      delta: 2
    });
  },
  noBtn: function() {
    this.setData({
      yetFlag: !1
    });
  },
  yetBtn: function() {
    return void this.setData({
      yetFlag: !1
    });
  },
  offBtn: function() {
    this.setData({
      ReasonFlag: !1
    });
  },
  confirmBtn: function() {
    var a = this;
    if (a.data.oldDoctorId = a.data.doctorId, 0 != a.data.myTeam.length ? (a.data.doctorId = a.data.targetDoctor.teamId,
        a.data.oldUrl = a.data.url, a.data.url = "team/sign/info/") : a.data.doctorId = a.data.targetDoctor.doctorId,
      a.data.confirmFlag = !0, 0 == a.data.targetDoctor.signState) a.setData({
      signId: a.data.targetDoctor.signId
    }), t.default.getDoctor(a);
    else {
      if (a.setData({
          signId: a.data.targetDoctor.signId
        }), !this.data.reasonIndex || !this.data.reasonText) return void wx.showToast({
        title: "请选择解约原因",
        icon: "none",
        duration: 2e3
      });
      t.default.relieve(a);
    }
    wx.removeStorageSync("myDoctor"), wx.removeStorageSync("myNurse"), wx.removeStorageSync("myTeam"),
      a.data.myDoctor = [], a.data.myNurse = [], a.data.myTeam = [];
  },
  chooseReason: function(t) {
    console.log(t), this.setData({
      reasonIndex: t.target.dataset.disreason,
      reasonText: t.target.dataset.text
    });
  },
  Select: function(a) {
    console.log(a)
    let that = this;
    let aaa = Number(a.target.dataset.current);
    this.setData({
      options: aaa
    });
  }
});